#ifndef __MOD_ICMP6__
#define __MOD_ICMP6__

#include "decoder.hpp"

//==========================================================
class Icmp6Session : public Session
{
public:
};

//==========================================================
class Icmp6SessionRoot : public SessionRoot
{
public:
  PTree<Session> ssn;
};

//==========================================================
class Icmp6Filter : public NDecFilter 
{
  friend class Icmp6Decoder;

private:
  u_int8_t data;

  enum FilterType
    {
      FT_NULL = 0,
      FT_ICMP_TYPE,
      FT_ICMP_CODE,
    } type;

public:
  Icmp6Filter (FilterType t) : data (0), type (t) 
  {
    if (this->type == FT_ICMP_TYPE || this->type == FT_ICMP_CODE)
      this->setResultType (RT_INT);
  }
  ~Icmp6Filter () {}

  bool setup (string &arg);
  void check (NDecResult &res);
};

//==========================================================
class Icmp6Record : public Record
{
public:
  Icmp6Record () {}
  ~Icmp6Record () {}  
};

//==========================================================
class Icmp6Decoder : public Decoder
{
private:
  static const int SSN_TIMEOUT = 600;
  static const bool DEBUG = false;
  Icmp6Record rec;

public:
  Icmp6Decoder () {};
  ~Icmp6Decoder () {};
  
  Record * decode (Packet &pkt, Record &prev);
  Icmp6Session * fetchIcmp6Session (Record &prev, u_int16_t &sport, u_int16_t &dport);
  NDecFilter * makeFilter (string &name);
};

#endif /* __MOD_ICMP6__ */
